
const mongoose = require('./db')
const OrderSchema = new mongoose.Schema({
    title: String,
    price: Number,
    num: Number,
    time: {
        type: String,
        default: 600000
    },
    state: {
        type: Boolean,
        default: false
    },
    type: {
        type: mongoose.Types.ObjectId,
        ref: "type"
    }
})

const TypeSchema = new mongoose.Schema({
    title: String
})

let orderModel = mongoose.model('order', OrderSchema, 'order')

let typeModel = mongoose.model("type", TypeSchema, 'type')


module.exports = {
    orderModel,
    typeModel
}